﻿window.InboxPageSwitch = {};
InboxPageSwitch.Url = "";
//创建XMLHttpRequest对象
			function createXMLHttpRequest(){
			    if(window.XMLHttpRequest){
			     	XMLHttpReq=new XMLHttpRequest();
			    }else if(window.ActiveXObject){
				     try{
				      	XMLHttpReq=new ActiveXObject("Msxml2.XMLHTTP");
				     }catch(e){
					      try{
					       	XMLHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
					      }catch(e){}
				     }
			    }
	   		}
			
			//发送请求函数
		   	function ajaxSendRequest(url){
			    createXMLHttpRequest();				    	   
			    XMLHttpReq.open("GET",url,true);			    			    
			    //XMLHttpReq.onreadystatechange=processResponse;			    		    
			    XMLHttpReq.send(null);			   
		   	}
		   	//处理返回信息函数
//		    function processResponse(){
//			    if(XMLHttpReq.readyState==4){
//				     if(XMLHttpReq.status==200){ 			          	
//				      	
//				     }else{
//				      	window.alert("ERROR!");
//				     }
//			    }
//		    }
		   	//

function ActionClick(EventNo, Memo) {
    ActionLogAdd('0', EventNo, Memo, '');
}
function ActionClickChild(EventNo, Memo) {
    if (typeof (aCPN) == "undefined" || typeof (aCKey) == "undefined") {
        return;
    }
    ActionLogAdd(aCPN, EventNo, Memo, aCKey);
}
//功能使用情况日志记录 Module模块名 EventName事件名 LogPath自定义文件夹名
function ActionLogAdd(CPageNo, EventNo, Memo, CKey) {
    try {
        if (typeof (aIsUs) == "undefined" || typeof (aPN) == "undefined" || typeof (aMk) == "undefined" || typeof (aKey) == "undefined") {
            return;
        }
        if (aIsUs) {
            var strPostData = {
                pn: aPN,
                mk: aMk,
                cpn: CPageNo,
                en: EventNo,
                memo: Memo,
                key: aKey,
                ckey: CKey
            };
            $.ajax(
            {
                type: "POST",
                async: false,
                url: "../Ajax/GlobalActionLogAjax.aspx",
                data: strPostData
            });
        }
    }
    catch (e) { }
}

/*返回新版*/
InboxPageSwitch.GoToNewPage = function (url) {
    InboxPageSwitch.Url = url;
    var postData = { doType: 'GoToPage', pagecode: "4" };
    $.ajax(
        {
            type: "post",
            async: true,
            dataType: 'xml',
            url: "../Ajax/InboxResume/GlobalInboxCommonAjax.ashx",
            data: postData,
            beforeSend: function () {
            },
            success: function (result) {
                //成功直接跳转
                var msgType = $(result).find('msgtype').eq(0).text();
                var content = $(result).find('returninfo').eq(0).text();
                if (msgType == '1') {
                    window.location.href = url;
                }
                else {
                    if (varLang == "EN-US")
                        window.location.href = "../MainLoginEN.aspx";
                    else
                        window.location.href = "../MainLogin.aspx";
                }
            },
            complete: function (XMLHttpRequest, textStatus) {
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
            }
        });
}
 InboxPageSwitch.InboxAddLog=function(pageNo,eventNo,memo,logtype){
        //验证用key，未定义直接返回
        if(typeof(strKey)=="undefined")return;
        if(typeof(memo)=="undefined") memo="";
        if(typeof(logtype)=="undefined" || logtype=="") logtype="event";
        var img = new Image;
        img.src = "../Ajax/Common/GlobalActionLogAjax.ashx?logType="+logtype+"&pageNo="+pageNo+"&memo="+ encodeURIComponent(memo)+"&eventNo="+eventNo+"&Key="+strKey+"&rnd="+Math.random();
    }﻿ 